<%-- 
    Document   : timkiem
    Created on : Dec 22, 2011, 9:16:41 PM
    Author     : BlueZky
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<link rel="stylesheet" type="text/css" href="styles/userstyles.css">
<link rel="stylesheet" type="text/css" href="styles/simple.css"/>
<!DOCTYPE html>


<script>
    $(document).ready(function(){
        $('#catalog').change(function(){
            var dt = $(this).val();
            dt = 'a=sub-catalog&id=' + dt;
            
            $.ajax({
                url:'ajax',
                type:'POST',
                cache:false,
                data:dt,
                success: function(dataString){
                    var data = $.parseJSON(dataString);
                    
                    $('#sub-catalog').html(" ");
                    $('#sub-catalog').append('<option value="0">--Chọn danh mục con--</option>');
                    for(var i = 0; i < data.data.length; i++){
                        var temp = '<option value="' + data.data[i].ma + '" >';
                        temp += data.data[i].ten +'</option>';
                        $('#sub-catalog').append(temp);
                    }
                    $('#hidden-row').fadeIn("fast");
                },
                error: function(){
                    alert("Không load được dữ liệu.");
                }
                
            });
            
        });
    });
</script>
<div class="content">
    <!-- Product section-->
    <div class="partion">
        <div class="utitle">Tìm kiếm nâng cao</div>
        <form method="get" action="timkiem.htm">
            <input type="hidden" name="a" value="a"/>
            <table>
                <tr>
                    <td class="cell-left">Từ khóa tìm kiếm</td>
                    <td class="cell-right input"><input  type="text" name="search" value="" placeholder="nhập từ khóa cần tìm" /></td>
                </tr>
                <tr>
                    <td class="cell-left">Danh mục</td>
                    <td class="cell-right input">
                        <div  class="mselect" style="width: 200px">
                            <select  id="catalog" name="catalog" style="width: 200px">
                                <option value="0">--Chọn danh mục--</option>
                                <c:forEach items="${danhMuc}" var="item" varStatus="status">
                                    <option value="${item.ma}">${item.ten}</option>
                                </c:forEach>
                            </select>
                        </div>
                    </td>
                </tr>
                <tr id="hidden-row" style="display: none;">
                    <td class="cell-left">Danh mục</td>
                    <td class="cell-right input">
                        <div  class="mselect" style="width: 200px">
                            <select id="sub-catalog" name="sub-catalog" style="width: 200px">
                                <option value="0">--họn danh mục con--</option>
                            </select>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td class="cell-left">Giá bán</td>
                    <td class="cell-right input">
                        <div  class="mselect" style="width: 200px">
                            <select   name="price" style="width: 200px">
                                <option value ="0">Chọn giá</option>
                                <option value ="50">< 50$</option>
                                <option value ="100">50$ - 100$</option>
                                <option value ="200">100$ - 200$</option>
                                <option value ="500">200$ - 500$</option>
                                <option value ="1000">500$ - 1000$</option>
                                <option value ="1500">1000$ - 1500$</option>
                                <option value ="2000">1500$ - 2000$</option>
                                <option value ="2001">> 2000$</option>
                            </select>
                        </div>

                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td class="cell-right button" > <input type="submit" name="login" value="Bắt đầu tìm" /></td>
                </tr>
            </table>
        </form>
    </div>
    <!-- End product section-->


</div>